package vista;
import java.awt.BorderLayout;
import java.awt.event.*;

import javax.swing.*;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaCategoria extends javax.swing.JFrame {
	private JPanel panCategoria;
	private JButton btnCancelar;
	private JButton btnSalir;
	private JButton btnGuardar;
	private JButton btnBuscar;
	private JTextField txtDescripcion;
	private JTextField txtNombreCategoria;
	private JTextField txtCodigoCategoria;
	private JLabel lblDescripcion;
	private JLabel lblNombre;
	private JLabel lblCodigo;

	/**
	* Auto-generated main method to display this JFrame
	*/
		
	public VentanaCategoria() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			setTitle("Registrar Categoria");
			{
				panCategoria = new JPanel();
				getContentPane().add(panCategoria, BorderLayout.CENTER);
				panCategoria.setLayout(null);
				panCategoria.setBackground(new java.awt.Color(255,255,255));
				{
					lblCodigo = new JLabel();
					panCategoria.add(lblCodigo);
					lblCodigo.setText("Codigo");
					lblCodigo.setBounds(45, 40, 72, 21);
					lblCodigo.setForeground(new java.awt.Color(18,6,249));
					lblCodigo.setFont(new java.awt.Font("Comic Sans MS",1,12));
				}
				{
					lblNombre = new JLabel();
					panCategoria.add(lblNombre);
					lblNombre.setText("Nombre");
					lblNombre.setBounds(45, 78, 72, 21);
					lblNombre.setFont(new java.awt.Font("Comic Sans MS",1,12));
					lblNombre.setForeground(new java.awt.Color(18,6,249));
				}
				{
					lblDescripcion = new JLabel();
					panCategoria.add(lblDescripcion);
					lblDescripcion.setText("Descripcion");
					lblDescripcion.setBounds(45, 117, 72, 21);
					lblDescripcion.setForeground(new java.awt.Color(19,6,249));
					lblDescripcion.setFont(new java.awt.Font("Comic Sans MS",1,12));
				}
				{
					txtCodigoCategoria = new JTextField();
					panCategoria.add(txtCodigoCategoria);
					txtCodigoCategoria.setBounds(129, 40, 133, 21);
				}
				{
					txtNombreCategoria = new JTextField();
					panCategoria.add(txtNombreCategoria);
					txtNombreCategoria.setBounds(129, 78, 133, 21);
				}
				{
					txtDescripcion = new JTextField();
					panCategoria.add(txtDescripcion);
					txtDescripcion.setBounds(129, 117, 133, 21);
				}
				{
					btnBuscar = new JButton();
					panCategoria.add(btnBuscar);
					btnBuscar.setText("Buscar");
					btnBuscar.setBounds(313, 40, 90, 21);
					btnBuscar.setBackground(new java.awt.Color(18,6,249));
					btnBuscar.setForeground(new java.awt.Color(252,221,3));
					btnBuscar.setFont(new java.awt.Font("Comic Sans MS",1,12));
				}
				{
					btnGuardar = new JButton();
					panCategoria.add(btnGuardar);
					btnGuardar.setText("Guardar");
					btnGuardar.setBounds(45, 207, 106, 40);
					btnGuardar.setFont(new java.awt.Font("Comic Sans MS",1,12));
					btnGuardar.setForeground(new java.awt.Color(252,221,3));
					btnGuardar.setBackground(new java.awt.Color(18,6,249));
				}
				{
					btnCancelar = new JButton();
					panCategoria.add(btnCancelar);
					btnCancelar.setText("Cancelar");
					btnCancelar.setBounds(170, 207, 106, 40);
					btnCancelar.setFont(new java.awt.Font("Comic Sans MS",1,12));
					btnCancelar.setForeground(new java.awt.Color(252,221,3));
					btnCancelar.setBackground(new java.awt.Color(18,6,249));
				}
				{
					btnSalir = new JButton();
					panCategoria.add(btnSalir);
					btnSalir.setText("Salir");
					btnSalir.setBounds(297, 207, 106, 40);
					btnSalir.setFont(new java.awt.Font("Comic Sans MS",1,12));
					btnSalir.setForeground(new java.awt.Color(252,221,3));
					btnSalir.setBackground(new java.awt.Color(18,6,249));
				}
			}
			pack();
			this.setSize(469, 309);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void addListener(ActionListener actionlistener){
		this.btnBuscar.addActionListener(actionlistener);
		this.btnGuardar.addActionListener(actionlistener);
		this.btnCancelar.addActionListener(actionlistener);
		this.btnSalir.addActionListener(actionlistener);
	}
	
	public String getCodigoCategoria(){
		return this.txtCodigoCategoria.getText();
	}
	
	public String getNombreCategoria(){
		return this.txtNombreCategoria.getText();
	}
	
	public String getDescripcion(){
		return this.txtDescripcion.getText();
	}
	
	public void borrarDatos(){
		txtCodigoCategoria.setText("");
		txtNombreCategoria.setText("");
		txtDescripcion.setText("");
	}
	
	public void mostrarMensaje(String mensaje) {
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	public void setCodigoCategoria(){
		this.txtCodigoCategoria.setText("");
		this.txtCodigoCategoria.requestFocus();
	}

}
